% ************************************************************************ 
%     Module name   : Lynx Simulation - main framework function                                                   
%                                                                          
%     Description   : This will house the simulation.                                                    
%                                                                          
%     $Header: /Lynx/SimulationFramework/RSP/IFS/IFSRun.m 2     15/10/08 16:08 Lwabeke $ 
%                                                                          
%    $Author: Lwabeke $	            
%                                                                         
%    $Revision: 2 $                
%                                                                         
% ************************************************************************
%     $History: IFSRun.m $ 
% 
%
% ************************************************************************

function [radarState] = radar_discard(old_radarState, param)
global worldState;

radarState = old_radarState;
retainedTgt = 0;

for tgtCntr=1:old_radarState.TargetList.numTargets
  if (old_radarState.TargetList.Targets(tgtCntr).RangeEstStd < param.radarModes.Discard.rangeEstStdLimit)
      retainedTgt = retainedTgt + 1;
      radarState.TargetList.Targets(retainedTgt) = old_radarState.TargetList.Targets(tgtCntr);
  else
      worldState.Target(old_radarState.TargetList.Targets(tgtCntr).id).found = 0; % Reset found flag
  end
end

radarState.TargetList.Targets = radarState.TargetList.Targets(1:retainedTgt); % Dump all remaining targets
radarState.TargetList.numTargets = retainedTgt;
